home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MPEG Toolkit
/
MPEG Toolkit.iso
/
win
/
med-lib
/
mdctrl.z
/
MDCLOAD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-11
|
20KB
|
333 lines
/* ********************************************************************** */
/* *** Name: mdCLoad.c *** */
/* *** (c) 1993, 1994, 1995 MediaDynamics Inc. *** */
/* *** *** */
/* *** *** */
/* *** *** */
/* *** ___ ___ *** */
/* *** | \ / | *** */
/* *** | \ / | *** */
/* *** | \ / | *** */
/* *** | \ __ /___ | *** */
/* *** | |\ \ | | |\ *** */
/* *** | | \ \| -----| | \ *** */
/* *** | | \ \/ / | | \ *** */
/* *** | | \ / | |\ \ *** */
/* *** | | \ / | | | | *** */
/* *** | | \ /| | | | | *** */
/* *** |__| \/ | |__| | | *** */
/* *** | | | | *** */
/* *** | | / / *** */
/* *** | |-------/ / *** */
/* *** |____________/ *** */
/* *** *** */
/* *** *** */
/* *** *** */
/* *** *** */
/* ********************************************************************** */
/* ********************************************************************** */
/* *** *** */
/* *** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE *** */
/* *** *** */
/* *** (C) Copyright MediaDynamics Inc. 1995. All rights reserved. *** */
/* *** *** */
/* *** You have a royalty-free right to use these sample files as *** */
/* *** long as the resulting application is in a compiled (runtime) *** */
/* *** form. You do not have the right to redistribute source code *** */
/* *** within your product or application without the express *** */
/* *** written consent of MediaDynamics Inc. *** */
/* *** *** */
/* ********************************************************************** */
/* The following pragmas are for Visual C++ */
#pragma warning ( disable: 4100 ) /* disable the unreferenced formal */
#pragma warning ( disable: 4001 ) /* disable the nonstandard comment */
#pragma warning ( disable: 4213 ) /* disable the cast on l-value */
#include <Windows.h>
#include "mdcfunc.h"
#define MDCTRL_DLL "mdctrl.dll"
BOOL WINAPI UnloadMDCtrlLibrary( void );
/* ********************************************************************** */
/* *** LoadMDCtrlLibrary *** */
/* *** *** */
/* *** Load the Media Control Library functions. *** */
/* *** *** */
/* ********************************************************************** */
BOOL WINAPI LoadMDCtrlLibrary( void )
{
UINT uOldSEMVal;
uOldSEMVal = SetErrorMode( SEM_NOOPENFILEERRORBOX );
mhInstMDCtrl = LoadLibrary( MDCTRL_DLL );
SetErrorMode( uOldSEMVal );
if ( mhInstMDCtrl < HINSTANCE_ERROR )
return FALSE;
/* ********************************************************************** */
/* *** Version Check *** */
/* ********************************************************************** */
if ( ( (FARPROC) mdGetVersion = GetProcAddress( mhInstMDCtrl, MDGETVERSION ) ) == (FARPROC) NULL )
{
UnloadMDCtrlLibrary( );
return FALSE;
}
if ( mdGetVersion() < MD_VERSION_BASE )
{
UnloadMDCtrlLibrary( );
return FALSE;
}
/* ********************************************************************** */
/* *** Prototypes: Control Functions (17) *** */
/* ********************************************************************** */
(FARPROC) mdOpen = GetProcAddress( mhInstMDCtrl, MDOPEN );
(FARPROC) mdOpenLite = GetProcAddress( mhInstMDCtrl, MDOPENLITE );
(FARPROC) mdClose = GetProcAddress( mhInstMDCtrl, MDCLOSE );
(FARPROC) mdPlay = GetProcAddress( mhInstMDCtrl, MDPLAY );
(FARPROC) mdPause = GetProcAddress( mhInstMDCtrl, MDPAUSE );
(FARPROC) mdStep = GetProcAddress( mhInstMDCtrl, MDSTEP );
(FARPROC) mdStop = GetProcAddress( mhInstMDCtrl, MDSTOP );
(FARPROC) mdGotoFrame = GetProcAddress( mhInstMDCtrl, MDGOTOFRAME );
(FARPROC) mdRewind = GetProcAddress( mhInstMDCtrl, MDREWIND );
(FARPROC) mdRestart = GetProcAddress( mhInstMDCtrl, MDRESTART );
(FARPROC) mdOpenDevice = GetProcAddress( mhInstMDCtrl, MDOPENDEVICE );
(FARPROC) mdCloseDevice = GetProcAddress( mhInstMDCtrl, MDCLOSEDEVICE );
/* ********************************************************************** */
/* *** Prototypes: Custom Control Functions (4) *** */
/* ********************************************************************** */
(FARPROC) mdCloseInterface = GetProcAddress( mhInstMDCtrl, MDCLOSEINTERFACE );
(FARPROC) mdOpenInterface = GetProcAddress( mhInstMDCtrl, MDOPENINTERFACE );
(FARPROC) mdGetButtonClicked = GetProcAddress( mhInstMDCtrl, MDGETBUTTONCLICKED );
(FARPROC) mdSetInterfaceNo = GetProcAddress( mhInstMDCtrl, MDSETINTERFACENO );
/* ********************************************************************** */
/* *** Prototypes: Visual Basic Specific (1) *** */
/* ********************************************************************** */
(FARPROC) mdVBVOpen = GetProcAddress( mhInstMDCtrl, MDVBVOPEN );
/* ********************************************************************** */
/* *** Prototypes: Window Control Functions (6) *** */
/* ********************************************************************** */
(FARPROC) mdHide = GetProcAddress( mhInstMDCtrl, MDHIDE );
(FARPROC) mdShow = GetProcAddress( mhInstMDCtrl, MDSHOW );
(FARPROC) mdHideVideo = GetProcAddress( mhInstMDCtrl, MDHIDEVIDEO );
(FARPROC) mdShowVideo = GetProcAddress( mhInstMDCtrl, MDSHOWVIDEO );
(FARPROC) mdHideCtrl = GetProcAddress( mhInstMDCtrl, MDHIDECTRL );
(FARPROC) mdShowCtrl = GetProcAddress( mhInstMDCtrl, MDSHOWCTRL );
/* ********************************************************************** */
/* *** Prototypes: Parameter Setting Functions (26) *** */
/* ********************************************************************** */
(FARPROC) mdSetClip = GetProcAddress( mhInstMDCtrl, MDSETCLIP );
(FARPROC) mdSetWinPos = GetProcAddress( mhInstMDCtrl, MDSETWINPOS );
(FARPROC) mdSetWinSize = GetProcAddress( mhInstMDCtrl, MDSETWINSIZE );
(FARPROC) mdSetVideoWinPos = GetProcAddress( mhInstMDCtrl, MDSETVIDEOWINPOS );
(FARPROC) mdSetVideoWinSize = GetProcAddress( mhInstMDCtrl, MDSETVIDEOWINSIZE );
(FARPROC) mdSetCtrlWinPos = GetProcAddress( mhInstMDCtrl, MDSETCTRLWINPOS );
(FARPROC) mdSetCtrlWinSize = GetProcAddress( mhInstMDCtrl, MDSETCTRLWINSIZE );
(FARPROC) mdSetWindowMoveable = GetProcAddress( mhInstMDCtrl, MDSETWINDOWMOVEABLE );
(FARPROC) mdSetWindowInteractive = GetProcAddress( mhInstMDCtrl, MDSETWINDOWINTERACTIVE );
(FARPROC) mdSetAudioLevel = GetProcAddress( mhInstMDCtrl, MDSETAUDIOLEVEL );
(FARPROC) mdSetAudioMute = GetProcAddress( mhInstMDCtrl, MDSETAUDIOMUTE );
(FARPROC) mdSetCtrlType = GetProcAddress( mhInstMDCtrl, MDSETCTRLTYPE );
(FARPROC) mdSetWinBottom = GetProcAddress( mhInstMDCtrl, MDSETWINBOTTOM );
(FARPROC) mdSetWinTop = GetProcAddress( mhInstMDCtrl, MDSETWINTOP );
(FARPROC) mdSetNewParent = GetProcAddress( mhInstMDCtrl, MDSETNEWPARENT );
(FARPROC) mdSetClippingRegion = GetProcAddress( mhInstMDCtrl, MDSETCLIPPINGREGION );
(FARPROC) mdSetVideoWindowAspect = GetProcAddress( mhInstMDCtrl, MDSETVIDEOWINDOWASPECT );
(FARPROC) mdSetVideoAspect = GetProcAddress( mhInstMDCtrl, MDSETVIDEOASPECT );
(FARPROC) mdSetVideoOffset = GetProcAddress( mhInstMDCtrl, MDSETVIDEOOFFSET );
(FARPROC) mdSetVideoPalette = GetProcAddress( mhInstMDCtrl, MDSETVIDEOPALETTE );
(FARPROC) mdSetKeyColor = GetProcAddress( mhInstMDCtrl, MDSETKEYCOLOR );
(FARPROC) mdSetPlaybackSpeed = GetProcAddress( mhInstMDCtrl, MDSETPLAYBACKSPEED );
(FARPROC) mdSetActivePalette = GetProcAddress( mhInstMDCtrl, MDSETACTIVEPALETTE );
(FARPROC) mdSetPlayRepeat = GetProcAddress( mhInstMDCtrl, MDSETPLAYREPEAT );
(FARPROC) mdSetTimeFormat = GetProcAddress( mhInstMDCtrl, MDSETTIMEFORMAT );
(FARPROC) mdSetParamDirect = GetProcAddress( mhInstMDCtrl, MDSETPARAMDIRECT );
/* ********************************************************************** */
/* *** Prototypes: Information Functions (41) *** */
/* ********************************************************************** */
(FARPROC) mdGetFileType = GetProcAddress( mhInstMDCtrl, MDGETFILETYPE );
(FARPROC) mdGetWindowHandle = GetProcAddress( mhInstMDCtrl, MDGETWINDOWHANDLE );
(FARPROC) mdGetCtrlWindowHandle = GetProcAddress( mhInstMDCtrl, MDGETCTRLWINDOWHANDLE );
(FARPROC) mdGetDeviceId = GetProcAddress( mhInstMDCtrl, MDGETDEVICEID );
(FARPROC) mdGetFrame = GetProcAddress( mhInstMDCtrl, MDGETFRAME );
(FARPROC) mdGetClipFrame = GetProcAddress( mhInstMDCtrl, MDGETCLIPFRAME );
(FARPROC) mdGetLength = GetProcAddress( mhInstMDCtrl, MDGETLENGTH );
(FARPROC) mdGetClipLength = GetProcAddress( mhInstMDCtrl, MDGETCLIPLENGTH );
(FARPROC) mdGetPlayState = GetProcAddress( mhInstMDCtrl, MDGETPLAYSTATE );
(FARPROC) mdGetDisplayState = GetProcAddress( mhInstMDCtrl, MDGETDISPLAYSTATE );
(FARPROC) mdGetWinPos = GetProcAddress( mhInstMDCtrl, MDGETWINPOS );
(FARPROC) mdGetWinSize = GetProcAddress( mhInstMDCtrl, MDGETWINSIZE );
(FARPROC) mdGetVideoWinPos = GetProcAddress( mhInstMDCtrl, MDGETVIDEOWINPOS );
(FARPROC) mdGetVideoWinSize = GetProcAddress( mhInstMDCtrl, MDGETVIDEOWINSIZE );
(FARPROC) mdGetCtrlWinPos = GetProcAddress( mhInstMDCtrl, MDGETCTRLWINPOS );
(FARPROC) mdGetCtrlWinSize = GetProcAddress( mhInstMDCtrl, MDGETCTRLWINSIZE );
(FARPROC) mdGetWinX = GetProcAddress( mhInstMDCtrl, MDGETWINX );
(FARPROC) mdGetWinY = GetProcAddress( mhInstMDCtrl, MDGETWINY );
(FARPROC) mdGetWinWidth = GetProcAddress( mhInstMDCtrl, MDGETWINWIDTH );
(FARPROC) mdGetWinHeight = GetProcAddress( mhInstMDCtrl, MDGETWINHEIGHT );
(FARPROC) mdGetVideoWinX = GetProcAddress( mhInstMDCtrl, MDGETVIDEOWINX );
(FARPROC) mdGetVideoWinY = GetProcAddress( mhInstMDCtrl, MDGETVIDEOWINY );
(FARPROC) mdGetVideoWinWidth = GetProcAddress( mhInstMDCtrl, MDGETVIDEOWINWIDTH );
(FARPROC) mdGetVideoWinHeight = GetProcAddress( mhInstMDCtrl, MDGETVIDEOWINHEIGHT );
(FARPROC) mdGetCtrlWinX = GetProcAddress( mhInstMDCtrl, MDGETCTRLWINX );
(FARPROC) mdGetCtrlWinY = GetProcAddress( mhInstMDCtrl, MDGETCTRLWINY );
(FARPROC) mdGetCtrlWinWidth = GetProcAddress( mhInstMDCtrl, MDGETCTRLWINWIDTH );
(FARPROC) mdGetAreaClicked = GetProcAddress( mhInstMDCtrl, MDGETAREACLICKED );
(FARPROC) mdGetOpenFileCount = GetProcAddress( mhInstMDCtrl, MDGETOPENFILECOUNT );
(FARPROC) mdGetFrameRate = GetProcAddress( mhInstMDCtrl, MDGETFRAMERATE );
(FARPROC) mdGetPlayedStatus = GetProcAddress( mhInstMDCtrl, MDGETPLAYEDSTATUS );
(FARPROC) mdGetVolumeLevel = GetProcAddress( mhInstMDCtrl, MDGETVOLUMELEVEL );
(FARPROC) mdGetVideoImage = GetProcAddress( mhInstMDCtrl, MDGETVIDEOIMAGE );
(FARPROC) mdGetOrigVideoWinSize = GetProcAddress( mhInstMDCtrl, MDGETORIGVIDEOWINSIZE );
(FARPROC) mdGetFileName = GetProcAddress( mhInstMDCtrl, MDGETFILENAME );
(FARPROC) mdGetFramesSkipped = GetProcAddress( mhInstMDCtrl, MDGETFRAMESSKIPPED );
(FARPROC) mdGetClipFrames = GetProcAddress( mhInstMDCtrl, MDGETCLIPFRAMES );
(FARPROC) mdGetErrorNumber = GetProcAddress( mhInstMDCtrl, MDGETERRORNUMBER );
(FARPROC) mdGetPosClicked = GetProcAddress( mhInstMDCtrl, MDGETPOSCLICKED );
(FARPROC) mdGetXPosClicked = GetProcAddress( mhInstMDCtrl, MDGETXPOSCLICKED );
(FARPROC) mdGetYPosClicked = GetProcAddress( mhInstMDCtrl, MDGETYPOSCLICKED );
(FARPROC) mdGetVideoPalette = GetProcAddress( mhInstMDCtrl, MDGETVIDEOPALETTE );
/* ********************************************************************** */
/* *** Prototypes: Graphic Loading and Displaying Functions (7) *** */
/* ********************************************************************** */
(FARPROC) mdShowGraphic = GetProcAddress( mhInstMDCtrl, MDSHOWGRAPHIC );
(FARPROC) mdShowGraphicPos = GetProcAddress( mhInstMDCtrl, MDSHOWGRAPHICPOS );
(FARPROC) mdOpenGraphic = GetProcAddress( mhInstMDCtrl, MDOPENGRAPHIC );
(FARPROC) mdOpenGraphicKeep = GetProcAddress( mhInstMDCtrl, MDOPENGRAPHICKEEP );
(FARPROC) mdCloseGraphic = GetProcAddress( mhInstMDCtrl, MDCLOSEGRAPHIC );
(FARPROC) mdHideGraphic = GetProcAddress( mhInstMDCtrl, MDHIDEGRAPHIC );
(FARPROC) mdDisplayGraphic = GetProcAddress( mhInstMDCtrl, MDDISPLAYGRAPHIC );
/* ********************************************************************** */
/* *** Prototypes: Cursor Setting Functions (6) *** */
/* ********************************************************************** */
(FARPROC) mdSetCursor = GetProcAddress( mhInstMDCtrl, MDSETCURSOR );
(FARPROC) mdSetVideoCursor = GetProcAddress( mhInstMDCtrl, MDSETVIDEOCURSOR );
(FARPROC) mdSetCtrlCursor = GetProcAddress( mhInstMDCtrl, MDSETCTRLCURSOR );
(FARPROC) mdResetCursor = GetProcAddress( mhInstMDCtrl, MDRESETCURSOR );
(FARPROC) mdResetVideoCursor = GetProcAddress( mhInstMDCtrl, MDRESETVIDEOCURSOR );
(FARPROC) mdResetCtrlCursor = GetProcAddress( mhInstMDCtrl, MDRESETCTRLCURSOR );
/* ********************************************************************** */
/* *** Prototypes: Miscellaneous Functions (9) *** */
/* ********************************************************************** */
(FARPROC) mdTimedDelay = GetProcAddress( mhInstMDCtrl, MDTIMEDDELAY );
(FARPROC) mdFileDoesNotExist = GetProcAddress( mhInstMDCtrl, MDFILEDOESNOTEXIST );
(FARPROC) mdFileDoesExist = GetProcAddress( mhInstMDCtrl, MDFILEDOESEXIST );
(FARPROC) mdDisplayErrorMsgs = GetProcAddress( mhInstMDCtrl, MDDISPLAYERRORMSGS );
(FARPROC) mdAbout = GetProcAddress( mhInstMDCtrl, MDABOUT );
(FARPROC) mdMCISendString = GetProcAddress( mhInstMDCtrl, MDMCISENDSTRING );
(FARPROC) mdCDEject = GetProcAddress( mhInstMDCtrl, MDCDEJECT );
(FARPROC) mdSetupPlayStateCallback = GetProcAddress( mhInstMDCtrl, MDSETUPPLAYSTATECALLBACK );
(FARPROC) mdSetupCustBtnClickCallback = GetProcAddress( mhInstMDCtrl, MDSETUPCUSTBTNCLICKCALLBACK );
/* ********************************************************************** */
/* *** Prototypes: Audio Record Procedures (5) *** */
/* ********************************************************************** */
(FARPROC) mdWaveRecordInit = GetProcAddress( mhInstMDCtrl, MDWAVERECORDINIT );
(FARPROC) mdWaveClose = GetProcAddress( mhInstMDCtrl, MDWAVECLOSE );
(FARPROC) mdWaveRecord = GetProcAddress( mhInstMDCtrl, MDWAVERECORD );
(FARPROC) mdWaveRecordSave = GetProcAddress( mhInstMDCtrl, MDWAVERECORDSAVE );
(FARPROC) mdWaveRecordPlayback = GetProcAddress( mhInstMDCtrl, MDWAVERECORDPLAYBACK );
/* ********************************************************************** */
/* *** Prototypes: Secure A/V Functions (3) *** */
/* ********************************************************************** */
(FARPROC) mdRemoveAllSecureAVDrivers = GetProcAddress( mhInstMDCtrl, MDREMOVEALLSECUREAVDRIVERS );
(FARPROC) mdInstallSecureAVDriver = GetProcAddress( mhInstMDCtrl, MDINSTALLSECUREAVDRIVER );
(FARPROC) mdRemoveSecureAVDriver = GetProcAddress( mhInstMDCtrl, MDREMOVESECUREAVDRIVER );
/* ********************************************************************** */
/* *** Prototypes: Error Handling (3) *** */
/* ********************************************************************** */
(FARPROC) mdGetErrorNumber = GetProcAddress( mhInstMDCtrl, MDGETERRORNUMBER );
(FARPROC) mdGetErrorText = GetProcAddress( mhInstMDCtrl, MDGETERRORTEXT );
(FARPROC) mdLogErrors = GetProcAddress( mhInstMDCtrl, MDLOGERRORS );
/* ********************************************************************** */
/* *** Prototypes: Forced Shutdown/Load (2) *** */
/* ********************************************************************** */
(FARPROC) mdCloseLibrary = GetProcAddress( mhInstMDCtrl, MDCLOSELIBRARY );
(FARPROC) mdOpenLibrary = GetProcAddress( mhInstMDCtrl, MDOPENLIBRARY );
return TRUE;
}
/* ********************************************************************** */
/* *** UnloadMDCtrlLibrary *** */
/* *** *** */
/* *** Unload the Media Control Library functions. *** */
/* *** *** */
/* ********************************************************************** */
BOOL WINAPI UnloadMDCtrlLibrary( void )
{
if ( mhInstMDCtrl == NULL )
return FALSE; // Was not previously loaded
FreeLibrary( mhInstMDCtrl );
return TRUE;
}